import axios from '@/api';
//在这里做一些公共的配置

//根UrL
export const baseURL = () => "https://localhost:7013/";
//登录对应后台地址
export const authURL=()=>"https://localhost:7077";
//请求后端api接口的url地址
export const apiUrl = () => `${baseURL()}api`;




export const iconList = () => {
    return ['Tools', 'HomeFilled', 'Menu', 'Avatar', 'StarFilled','UserFilled',
        'Histogram', 'Grid', 'HelpFilled', 'Plus',
        'Minus', 'CirclePlus', 'Search',
        'Female', 'Male', 'Aim', 'House', 'FullScreen',
        'Service', 'Link', 'Pointer', 'Star',
        'Notification', 'Connection',
        'ChatDotRound', 'Setting', 'Clock', 'Position',
        'Discount', 'Message', 'QuestionFilled','CirclePlusFilled','DeleteFilled','Edit',
        'WarnTriangleFilled','Lock','Switch','User','Share']
}



import {
    Tools, HomeFilled, Menu, Avatar, StarFilled,
    Histogram, Grid, HelpFilled, Plus,
    Minus, CirclePlus, Search,
    Female, Male, Aim, House, FullScreen,
    Service, Link, Pointer, Star,
    Notification, Connection,
    ChatDotRound, Setting, Clock, Position,
    Discount, Message, QuestionFilled, UserFilled, Management, CirclePlusFilled,
    DeleteFilled,
    Edit,
    WarnTriangleFilled,
    Lock,
    Switch,
    User,
    Share

} from '@element-plus/icons-vue'


export const initIcon = (stricon) => {
    if (stricon == "Tools") {
        return Tools;
    }
    else if (stricon == "HomeFilled") {
        return Grid;
    }
    else if (stricon == "HomeFilled") {
        return Management;
    }
    else if (stricon == "Menu") {
        return Menu;
    }
    else if (stricon == "Avatar") {
        return Avatar;
    }
    else if (stricon == "StarFilled") {
        return StarFilled;
    }
    else if (stricon == "Histogram") {
        return Histogram;
    }
    else if (stricon == "Grid") {
        return Grid;
    }
    else if (stricon == "HelpFilled") {
        return HelpFilled;
    }
    else if (stricon == "Plus") {
        return Plus;
    }
    else if (stricon == "Minus") {
        return Minus;
    }
    else if (stricon == "CirclePlus") {
        return CirclePlus;
    }
    else if (stricon == "Female") {
        return Female;
    }
    else if (stricon == "Male") {
        return Male;
    }
    else if (stricon == "Aim") {
        return Aim;
    }
    else if (stricon == "House") {
        return House;
    }
    else if (stricon == "FullScreen") {
        return FullScreen;
    }
    else if (stricon == "Service") {
        return Service;
    }
    else if (stricon == "Link") {
        return Link;
    }
    else if (stricon == "Pointer") {
        return Pointer;
    }
    else if (stricon == "Star") {
        return Star;
    }
    else if (stricon == "Notification") {
        return Notification;
    }
    else if (stricon == "Connection") {
        return Connection;
    }
    else if (stricon == "ChatDotRound") {
        return ChatDotRound;
    }
    else if (stricon == "Setting") {
        return Setting;
    }
    else if (stricon == "Clock") {
        return Clock;
    }
    else if (stricon == "Position") {
        return Position;
    }
    else if (stricon == "Discount") {
        return Discount;
    }
    else if (stricon == "Message") {
        return Message;
    }
    else if (stricon == "QuestionFilled") {
        return QuestionFilled;
    }
    else if (stricon == "UserFilled") {
        return UserFilled;
    }
    if (stricon == "CirclePlusFilled") {
        return CirclePlusFilled;
    }
    else if (stricon == "Search") {
        return Search;
    } 
    else if (stricon == "DeleteFilled") {
        return DeleteFilled;
    }
    else if (stricon == "Edit") {
        return Edit;
    } 
    else if (stricon == "WarnTriangleFilled") {
        return WarnTriangleFilled;
    } 
    else if (stricon == "Lock") {
        return Lock;
    }  
    else if (stricon == "Switch") {
        return Switch;
    }  
    else if (stricon == "Menu") {
        return Menu;
    }  
    else if (stricon == "UserFilled") {
        return UserFilled;
    }  
    else if (stricon == "Tools") {
        return Tools;
    }  
    else if (stricon == "User") {
        return User;
    }  
    else if (stricon == "Share") {
        return Share;
    }  
}

export const currentMenuPermission = async (menuid) => {
    let reponse = await axios.get(`/Menu/GetCurrentMenuPermission/${menuid}`);
    let { data, success } = reponse.data;
    if (success) {
        // return data; 
        var result = new Array();
        data.forEach(element => {
            result.push(element);
        });
        console.log(result)
        return result;
    }
    return new Array();
}